﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Vkontakte.Api;
using Vkontakte.Api.Operations;

namespace SampleWinForms
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
			authenticator1.Authenticated += new Action(authenticator1_Authenticated);
			authenticator1.LoginCanceled += new Action(authenticator1_LoginCanceled);
			authenticator1.NeedLoginData += new Action(authenticator1_NeedLoginData);
		}

		void authenticator1_NeedLoginData()
		{
			
		}

		void authenticator1_LoginCanceled()
		{
			
		}

		void authenticator1_Authenticated()
		{
			ApiClient apiClient = new ApiClient( 1912632, authenticator1.GetAuthorizationToken() );
			ProfilesGet q=new ProfilesGet();
			q.Uids.Add( apiClient.MyID );
			q.Completed += new Action(q_Completed);
			apiClient.ExecuteQuerry( q );
		}

		void q_Completed()
		{
			MessageBox.Show( "Querry Completed" );
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			authenticator1.ApplicationAccess = ApplicationAccess.AllExceptAddLeft;
			authenticator1.AppID = 1912632;
			authenticator1.Authenticate();
		}
	}
}
